#!/bin/bash

FILE_PATH="/home/jamesbin/clog/out/build/test_package/clogger.log"
MAX_SIZE=104857600

while true; do
    FILE_SIZE=$(stat -c %s "$FILE_PATH")

    if [ "$FILE_SIZE" -gt "$MAX_SIZE" ]; then
        echo "File size exceeds 100MB ($FILE_SIZE bytes), deleting file: $FILE_PATH"
        
        rm -f "$FILE_PATH"
        echo "File deleted successfully."
    fi

    sleep 10
done
